<template>
	<view class="c-content">
		<view class="empty" v-if="isShow">
			<empty></empty>
		</view>
		<view class="c-list">
			<view class="c-item" v-for="item in caseList" :key="item.id">
				<view class="title" @click="caseChoose(item.name)">
					{{item.name}}
				</view>
			</view>
			<view class="divide-line" v-if="this.caseList.length != 0">
				<u-divider text="我是有底线的"></u-divider>
			</view>
		</view>
	</view>
</template>

<script>
	import empty from "@/components/empty/empty.vue";
	export default {
		components: {
			empty
		},
		data() {
			return {
				caseList: [],
				caseId: "",
			}
		},
		computed: {
			isShow() {
				return this.caseList.length == 0;
			}
		},
		mounted() {
			this.baseListRequest();
		},
		methods: {
			baseListRequest() {
				const that = this;
				let data = {};
				uni.showLoading({
					title:"加载中"
				})
				this.$sendRequest.getCaseList(data).then((res) => {
					uni.hideLoading();
					if (res.code == 200) {
						this.caseList = res.data;
					} else {
						this.$refs.uToast.show({
							message: res.message,
							type: 'error',
						})
					}
				}).catch(err => {})
			},
			caseChoose(val) {
				uni.navigateBack({
					url: '/pages/caseList/schedule/newSchedule'
				})
				uni.$emit('setData', {
					name: val
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.c-item {
		width: 100%;
		background-color: #fff;
		padding: 0 30rpx;
	
		.title {
			padding: 16rpx 0;
			border-bottom: solid 0.5px #f1f3f5;
		}
	}

	.empty {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 100vh;
	}
</style>